using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.IO;

using SypConst.Garbage;
using SypEngine;
using SypGui.CreateForms;

namespace SypGui.CreateForms
{
    public partial class ProcessStep3 : SypUserControl
    {
        public override void Reset()
        {
        }

        protected override void InitializeUC()
        {
            base.InitializeUC();
            Location = new Point(0, 0);
        }

        public ProcessStep3() : base ()
        {
            ((SypFormDesign)Parent).InitPosition();
        }

        public ProcessStep3(SetText OutputMethod, SypForm SypForm)
            : base (OutputMethod)
        {
            SypForm.evt_onReturnLocalStepProgressReceived += new SypForm.onReturnStepProgressReceived(UpdateProgressBar);
        }

        private void UpdateProgressBar(int step, int total)
        {
            if (total != 0)
            {
                int result = (step * 100) / total;
                if (result <= 100)
                    SypStep3ProgressBar.Value = result;
            }
            else
            {
                SypStep3ProgressBar.Value = 100;
            }
        }
    }
}
